﻿using System;
using System.Xml;
using UnityEngine;

namespace Hydrogen.MarkovChain
{
    /// <summary>
    /// 出发点
    /// </summary>
    [RuleNodeName(RuleConstant.NODE_SP), Serializable]
    public class RuleSP : RuleNodeBase
    {
        public Vector3Int Pos { get; }
        public SolidType SolidType { get; } = SolidType.W;

        public RuleSP() : base(null)
        {
            Pos = Vector3Int.zero;
            SolidType = SolidType.W;
        }
        public RuleSP(XmlNode node) : base(node)
        {
            var pos = node?.GetAttributeValue(RuleConstant.SP_POS);
            Pos = Utils.Str2V3(pos);
            var type = node?.GetAttributeValue(RuleConstant.SP_COLOR);
            if (!string.IsNullOrEmpty(type)) SolidType = Utils.Char2SolidType(type[0]);
        }
    }
}
